package com.cskaoyan.day16;

import java.util.Scanner;

public class JudgeSymmetry {
    public static void main(String[] args) {
        int count = 0;
        while (count++ != 5) {
            System.out.printf("请输入字符串:");
            Scanner scanner = new Scanner(System.in);
            String s = scanner.nextLine();
            if (judgeSymmetry(s)) {
                System.out.println(s + "是对称字符串");
            } else {
                System.out.println(s + "不是对称字符串");
            }
        }

    }

    public static boolean judgeSymmetry(String str) {
        for (int i = 0, j = str.length() - 1; i < j; i++, j--) {
            if (str.charAt(i) != str.charAt(j)) {
                return false;
            }
        }
        return true;
    }
}
